package com.superc.lib.helper;

import java.util.HashMap;

import com.superc.R;

import android.content.Context;

public class ResourceHelper {

	private static HashMap<String,String> mineTypes=null; 
	
	public static String getString(Context context,int resourceID){
		return context.getString(resourceID);
	}
	
	public static void initMineType(Context context){
		if(mineTypes==null){
			mineTypes=new HashMap<String, String>();
			String[] types=context.getResources().getStringArray(R.array.strMimeType);
			for (String mineType : types) {
				mineTypes.put(FuncHelper.getLeftPart(mineType, ",",true), FuncHelper.getRightPart(mineType, ",", true));
			}
		}
	}
	
	public static String getMimeType(String filename){
		if(mineTypes!=null){
			return mineTypes.get(FuncHelper.getRightPart(filename, ".", false));
		}
		return null;
	}
	
}
